package com.fand.platform.userCenter.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import lombok.val;

import org.apache.commons.lang3.StringUtils;

import com.fand.dto.PaginationDto;
import com.fand.persistent.builder.ModelArgs;
import com.fand.persistent.builder.ModelBuilder;
import com.fand.persistent.builder.ModelBuilderUtils;
import com.fand.persistent.support.DaoJdbcSupport;
import com.fand.platform.userCenter.dto.DepartmentDto;
import com.fand.platform.userCenter.dto.DepartmentLoDto;
import com.fand.platform.userCenter.dto.DepartmentLaDto;
import com.fand.platform.userCenter.dto.DepartmentLaLoDto;
import com.fand.platform.userCenter.dto.DepartmentReDto;
import com.fand.platform.userCenter.dto.DepartmentReLoDto;
import com.fand.platform.userCenter.dto.DepartmentCuInEfDto;

/**
 * 部门
 *
 * @author yaoHT
 * 
 */
public class DepartmentJdbcDao extends DaoJdbcSupport implements DepartmentDao {

	@Override
	public int insertDepartmentBy1(DepartmentDto insertDepartment, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartment, insertProperties));
		return this.update("userCenter/department/insertDepartmentBy1", modelBuilder.build());
	}

	@Override
	public int insertDepartmentBy1_1(DepartmentDto insertDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartment));
				
		return this.update("userCenter/department/insertDepartmentBy1", modelBuilder.build());
	}

	@Override
	public int insertDepartmentBy2(DepartmentDto insertDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartment));

		return this.update("userCenter/department/insertDepartmentBy2", modelBuilder.build());
	}

	@Override
	public int deleteDepartmentBy1(DepartmentDto deleteDepartment, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartment,
				whereEqProperties));

		return this.update("userCenter/department/deleteDepartmentBy1", modelBuilder.build());
	}
	@Override
	public int deleteDepartmentBy1_1(DepartmentDto deleteDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartment));

		return this.update("userCenter/department/deleteDepartmentBy1", modelBuilder.build());
	}
	
	@Override
	public int deleteDepartmentByIds(DepartmentDto deleteDepartment) {
		val model = new HashMap<String, Object>();

		model.put("IDS", deleteDepartment.getIds());

		return this.update("userCenter/department/deleteDepartmentByIds", model);
	}

	@Override
	public int updateDepartmentBy1(DepartmentDto updateDepartment, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateDepartment, updateProperties), new ModelArgs(updateDepartment, whereEqProperties));

		return this.update("userCenter/department/updateDepartmentBy1", modelBuilder.build());
	}

	@Override
	public int updateDepartmentBy1_1(DepartmentDto updateDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateDepartment));

		return this.update("userCenter/department/updateDepartmentBy1", modelBuilder.build());
	}
	
	@Override
	public int updateDepartmentBy2(DepartmentDto updateDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateDepartment));

		return this.update("userCenter/department/updateDepartmentBy2", modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentBy1ForObject(Class<R> requiredType, DepartmentDto selectDepartment, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/department/selectDepartmentBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentBy1_1ForObject(Class<R> requiredType, DepartmentDto selectDepartment, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment));

		return this.selectForObject(requiredType, "userCenter/department/selectDepartmentBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentBy2ForObject(Class<R> requiredType, DepartmentDto selectDepartment, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment));

		return this.selectForObject(requiredType, "userCenter/department/selectDepartmentBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentBy1ForObjectList(Class<R> requiredType, DepartmentDto selectDepartment, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/department/selectDepartmentBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentBy1_1ForObjectList(Class<R> requiredType, DepartmentDto selectDepartment, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment));

		return this.selectForObjectList(requiredType, "userCenter/department/selectDepartmentBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentBy2ForObjectList(Class<R> requiredType, DepartmentDto selectDepartment, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment));

		return this.selectForObjectList(requiredType, "userCenter/department/selectDepartmentBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentBy1ForMappedObject(Class<R> mappedClass, DepartmentDto selectDepartment,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/department/selectDepartmentBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentBy1_1ForMappedObject(Class<R> mappedClass, DepartmentDto selectDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment));

		return this.selectForMappedObject(mappedClass, "userCenter/department/selectDepartmentBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentBy2ForMappedObject(Class<R> mappedClass, DepartmentDto selectDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment));

		return this.selectForMappedObject(mappedClass, "userCenter/department/selectDepartmentBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int selectDepartmentByCodeNqIdForInteger(DepartmentDto selectDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder();

//		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder().putExtend(null, "code", null,
//				selectDepartment.getCode());

//		if (StringUtils.isNotBlank(selectDepartment.getId())) {
//			modelBuilder.putExtend(ModelBuilder.WHERE__AND__NQ, "id", null, selectDepartment.getId());
//		}

		return this.selectForObject(Integer.class, "userCenter/department/selectDepartmentBy1ForObject", null,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentBy1ForMappedObjectList(Class<R> mappedClass, DepartmentDto selectDepartment,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/department/selectDepartmentBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentBy1_1ForMappedObjectList(Class<R> mappedClass, DepartmentDto selectDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment));

		return this.selectForMappedObjectList(mappedClass, "userCenter/department/selectDepartmentBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentBy2ForMappedObjectList(Class<R> mappedClass, DepartmentDto selectDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartment));

		return this.selectForMappedObjectList(mappedClass, "userCenter/department/selectDepartmentBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> PaginationDto<R> paginationDepartmentBy1ForMappedObjectList(Class<R> mappedClass,
				DepartmentDto paginationDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationDepartment));

		return this.paginationForMappedObjectList(mappedClass, "userCenter/department/selectDepartmentBy1ForObject",
				"userCenter/department/selectDepartmentBy1ForMappedObjectList",
				paginationDepartment.getPaginationNo(),
				paginationDepartment.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public PaginationDto<Map<String, Object>> paginationDepartmentBy1ForMapList(DepartmentDto paginationDepartment) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationDepartment));

		return this.paginationForMapList("userCenter/department/selectDepartmentBy1ForObject",
				"userCenter/department/selectDepartmentBy1ForMappedObjectList",
				paginationDepartment.getPaginationNo(),
				paginationDepartment.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public int insertDepartmentLoBy1(DepartmentLoDto insertDepartmentLo, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentLo, insertProperties));
		return this.update("userCenter/departmentLo/insertDepartmentLoBy1", modelBuilder.build());
	}

	@Override
	public int deleteDepartmentLoBy1(DepartmentLoDto deleteDepartmentLo, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartmentLo,
				whereEqProperties));

		return this.update("userCenter/departmentLo/deleteDepartmentLoBy1", modelBuilder.build());
	}

	@Override
	public int updateDepartmentLoBy1(DepartmentLoDto updateDepartmentLo, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateDepartmentLo, updateProperties), new ModelArgs(updateDepartmentLo, whereEqProperties));

		return this.update("userCenter/departmentLo/updateDepartmentLoBy1", modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLoBy1ForObject(Class<R> requiredType, DepartmentLoDto selectDepartmentLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLo,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/departmentLo/selectDepartmentLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLoBy1ForObjectList(Class<R> requiredType, DepartmentLoDto selectDepartmentLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLo,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/departmentLo/selectDepartmentLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLoBy1ForMappedObject(Class<R> mappedClass, DepartmentLoDto selectDepartmentLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/departmentLo/selectDepartmentLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLoBy1ForMappedObjectList(Class<R> mappedClass, DepartmentLoDto selectDepartmentLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentLo/selectDepartmentLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int insertDepartmentLaBy1(DepartmentLaDto insertDepartmentLa, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentLa, insertProperties));
		return this.update("userCenter/departmentLa/insertDepartmentLaBy1", modelBuilder.build());
	}

	@Override
	public int insertDepartmentLaBy1_1(DepartmentLaDto insertDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentLa));
				
		return this.update("userCenter/departmentLa/insertDepartmentLaBy1", modelBuilder.build());
	}

	@Override
	public int insertDepartmentLaBy2(DepartmentLaDto insertDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentLa));

		return this.update("userCenter/departmentLa/insertDepartmentLaBy2", modelBuilder.build());
	}

	@Override
	public int deleteDepartmentLaBy1(DepartmentLaDto deleteDepartmentLa, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartmentLa,
				whereEqProperties));

		return this.update("userCenter/departmentLa/deleteDepartmentLaBy1", modelBuilder.build());
	}
	@Override
	public int deleteDepartmentLaBy1_1(DepartmentLaDto deleteDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartmentLa));

		return this.update("userCenter/departmentLa/deleteDepartmentLaBy1", modelBuilder.build());
	}
	
	@Override
	public int deleteDepartmentLaByIds(DepartmentLaDto deleteDepartmentLa) {
		val model = new HashMap<String, Object>();

		model.put("IDS", deleteDepartmentLa.getIds());

		return this.update("userCenter/departmentLa/deleteDepartmentLaByIds", model);
	}

	@Override
	public int updateDepartmentLaBy1(DepartmentLaDto updateDepartmentLa, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateDepartmentLa, updateProperties), new ModelArgs(updateDepartmentLa, whereEqProperties));

		return this.update("userCenter/departmentLa/updateDepartmentLaBy1", modelBuilder.build());
	}

	@Override
	public int updateDepartmentLaBy1_1(DepartmentLaDto updateDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateDepartmentLa));

		return this.update("userCenter/departmentLa/updateDepartmentLaBy1", modelBuilder.build());
	}
	
	@Override
	public int updateDepartmentLaBy2(DepartmentLaDto updateDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateDepartmentLa));

		return this.update("userCenter/departmentLa/updateDepartmentLaBy2", modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLaBy1ForObject(Class<R> requiredType, DepartmentLaDto selectDepartmentLa, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/departmentLa/selectDepartmentLaBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLaBy1_1ForObject(Class<R> requiredType, DepartmentLaDto selectDepartmentLa, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa));

		return this.selectForObject(requiredType, "userCenter/departmentLa/selectDepartmentLaBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLaBy2ForObject(Class<R> requiredType, DepartmentLaDto selectDepartmentLa, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa));

		return this.selectForObject(requiredType, "userCenter/departmentLa/selectDepartmentLaBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLaBy1ForObjectList(Class<R> requiredType, DepartmentLaDto selectDepartmentLa, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/departmentLa/selectDepartmentLaBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLaBy1_1ForObjectList(Class<R> requiredType, DepartmentLaDto selectDepartmentLa, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa));

		return this.selectForObjectList(requiredType, "userCenter/departmentLa/selectDepartmentLaBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLaBy2ForObjectList(Class<R> requiredType, DepartmentLaDto selectDepartmentLa, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa));

		return this.selectForObjectList(requiredType, "userCenter/departmentLa/selectDepartmentLaBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLaBy1ForMappedObject(Class<R> mappedClass, DepartmentLaDto selectDepartmentLa,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/departmentLa/selectDepartmentLaBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLaBy1_1ForMappedObject(Class<R> mappedClass, DepartmentLaDto selectDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa));

		return this.selectForMappedObject(mappedClass, "userCenter/departmentLa/selectDepartmentLaBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLaBy2ForMappedObject(Class<R> mappedClass, DepartmentLaDto selectDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa));

		return this.selectForMappedObject(mappedClass, "userCenter/departmentLa/selectDepartmentLaBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int selectDepartmentLaByCodeNqIdForInteger(DepartmentLaDto selectDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder();

//		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder().putExtend(null, "code", null,
//				selectDepartmentLa.getCode());

//		if (StringUtils.isNotBlank(selectDepartmentLa.getId())) {
//			modelBuilder.putExtend(ModelBuilder.WHERE__AND__NQ, "id", null, selectDepartmentLa.getId());
//		}

		return this.selectForObject(Integer.class, "userCenter/departmentLa/selectDepartmentLaBy1ForObject", null,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLaBy1ForMappedObjectList(Class<R> mappedClass, DepartmentLaDto selectDepartmentLa,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentLa/selectDepartmentLaBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLaBy1_1ForMappedObjectList(Class<R> mappedClass, DepartmentLaDto selectDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa));

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentLa/selectDepartmentLaBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLaBy2ForMappedObjectList(Class<R> mappedClass, DepartmentLaDto selectDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLa));

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentLa/selectDepartmentLaBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> PaginationDto<R> paginationDepartmentLaBy1ForMappedObjectList(Class<R> mappedClass,
				DepartmentLaDto paginationDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationDepartmentLa));

		return this.paginationForMappedObjectList(mappedClass, "userCenter/departmentLa/selectDepartmentLaBy1ForObject",
				"userCenter/departmentLa/selectDepartmentLaBy1ForMappedObjectList",
				paginationDepartmentLa.getPaginationNo(),
				paginationDepartmentLa.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public PaginationDto<Map<String, Object>> paginationDepartmentLaBy1ForMapList(DepartmentLaDto paginationDepartmentLa) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationDepartmentLa));

		return this.paginationForMapList("userCenter/departmentLa/selectDepartmentLaBy1ForObject",
				"userCenter/departmentLa/selectDepartmentLaBy1ForMappedObjectList",
				paginationDepartmentLa.getPaginationNo(),
				paginationDepartmentLa.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public int insertDepartmentLaLoBy1(DepartmentLaLoDto insertDepartmentLaLo, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentLaLo, insertProperties));
		return this.update("userCenter/departmentLaLo/insertDepartmentLaLoBy1", modelBuilder.build());
	}

	@Override
	public int deleteDepartmentLaLoBy1(DepartmentLaLoDto deleteDepartmentLaLo, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartmentLaLo,
				whereEqProperties));

		return this.update("userCenter/departmentLaLo/deleteDepartmentLaLoBy1", modelBuilder.build());
	}

	@Override
	public int updateDepartmentLaLoBy1(DepartmentLaLoDto updateDepartmentLaLo, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateDepartmentLaLo, updateProperties), new ModelArgs(updateDepartmentLaLo, whereEqProperties));

		return this.update("userCenter/departmentLaLo/updateDepartmentLaLoBy1", modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLaLoBy1ForObject(Class<R> requiredType, DepartmentLaLoDto selectDepartmentLaLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLaLo,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/departmentLaLo/selectDepartmentLaLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLaLoBy1ForObjectList(Class<R> requiredType, DepartmentLaLoDto selectDepartmentLaLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLaLo,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/departmentLaLo/selectDepartmentLaLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentLaLoBy1ForMappedObject(Class<R> mappedClass, DepartmentLaLoDto selectDepartmentLaLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLaLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/departmentLaLo/selectDepartmentLaLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentLaLoBy1ForMappedObjectList(Class<R> mappedClass, DepartmentLaLoDto selectDepartmentLaLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentLaLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentLaLo/selectDepartmentLaLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int insertDepartmentReBy1(DepartmentReDto insertDepartmentRe, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentRe, insertProperties));
		return this.update("userCenter/departmentRe/insertDepartmentReBy1", modelBuilder.build());
	}

	@Override
	public int insertDepartmentReBy1_1(DepartmentReDto insertDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentRe));
				
		return this.update("userCenter/departmentRe/insertDepartmentReBy1", modelBuilder.build());
	}

	@Override
	public int insertDepartmentReBy2(DepartmentReDto insertDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentRe));

		return this.update("userCenter/departmentRe/insertDepartmentReBy2", modelBuilder.build());
	}

	@Override
	public int deleteDepartmentReBy1(DepartmentReDto deleteDepartmentRe, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartmentRe,
				whereEqProperties));

		return this.update("userCenter/departmentRe/deleteDepartmentReBy1", modelBuilder.build());
	}
	@Override
	public int deleteDepartmentReBy1_1(DepartmentReDto deleteDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartmentRe));

		return this.update("userCenter/departmentRe/deleteDepartmentReBy1", modelBuilder.build());
	}
	
	@Override
	public int deleteDepartmentReByIds(DepartmentReDto deleteDepartmentRe) {
		val model = new HashMap<String, Object>();

		model.put("IDS", deleteDepartmentRe.getIds());

		return this.update("userCenter/departmentRe/deleteDepartmentReByIds", model);
	}

	@Override
	public int updateDepartmentReBy1(DepartmentReDto updateDepartmentRe, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateDepartmentRe, updateProperties), new ModelArgs(updateDepartmentRe, whereEqProperties));

		return this.update("userCenter/departmentRe/updateDepartmentReBy1", modelBuilder.build());
	}

	@Override
	public int updateDepartmentReBy1_1(DepartmentReDto updateDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateDepartmentRe));

		return this.update("userCenter/departmentRe/updateDepartmentReBy1", modelBuilder.build());
	}
	
	@Override
	public int updateDepartmentReBy2(DepartmentReDto updateDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateDepartmentRe));

		return this.update("userCenter/departmentRe/updateDepartmentReBy2", modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentReBy1ForObject(Class<R> requiredType, DepartmentReDto selectDepartmentRe, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/departmentRe/selectDepartmentReBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentReBy1_1ForObject(Class<R> requiredType, DepartmentReDto selectDepartmentRe, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe));

		return this.selectForObject(requiredType, "userCenter/departmentRe/selectDepartmentReBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentReBy2ForObject(Class<R> requiredType, DepartmentReDto selectDepartmentRe, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe));

		return this.selectForObject(requiredType, "userCenter/departmentRe/selectDepartmentReBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentReBy1ForObjectList(Class<R> requiredType, DepartmentReDto selectDepartmentRe, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/departmentRe/selectDepartmentReBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentReBy1_1ForObjectList(Class<R> requiredType, DepartmentReDto selectDepartmentRe, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe));

		return this.selectForObjectList(requiredType, "userCenter/departmentRe/selectDepartmentReBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentReBy2ForObjectList(Class<R> requiredType, DepartmentReDto selectDepartmentRe, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe));

		return this.selectForObjectList(requiredType, "userCenter/departmentRe/selectDepartmentReBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentReBy1ForMappedObject(Class<R> mappedClass, DepartmentReDto selectDepartmentRe,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/departmentRe/selectDepartmentReBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentReBy1_1ForMappedObject(Class<R> mappedClass, DepartmentReDto selectDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe));

		return this.selectForMappedObject(mappedClass, "userCenter/departmentRe/selectDepartmentReBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentReBy2ForMappedObject(Class<R> mappedClass, DepartmentReDto selectDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe));

		return this.selectForMappedObject(mappedClass, "userCenter/departmentRe/selectDepartmentReBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int selectDepartmentReByCodeNqIdForInteger(DepartmentReDto selectDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder();

//		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder().putExtend(null, "code", null,
//				selectDepartmentRe.getCode());

//		if (StringUtils.isNotBlank(selectDepartmentRe.getId())) {
//			modelBuilder.putExtend(ModelBuilder.WHERE__AND__NQ, "id", null, selectDepartmentRe.getId());
//		}

		return this.selectForObject(Integer.class, "userCenter/departmentRe/selectDepartmentReBy1ForObject", null,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentReBy1ForMappedObjectList(Class<R> mappedClass, DepartmentReDto selectDepartmentRe,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentRe/selectDepartmentReBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentReBy1_1ForMappedObjectList(Class<R> mappedClass, DepartmentReDto selectDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe));

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentRe/selectDepartmentReBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentReBy2ForMappedObjectList(Class<R> mappedClass, DepartmentReDto selectDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentRe));

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentRe/selectDepartmentReBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> PaginationDto<R> paginationDepartmentReBy1ForMappedObjectList(Class<R> mappedClass,
				DepartmentReDto paginationDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationDepartmentRe));

		return this.paginationForMappedObjectList(mappedClass, "userCenter/departmentRe/selectDepartmentReBy1ForObject",
				"userCenter/departmentRe/selectDepartmentReBy1ForMappedObjectList",
				paginationDepartmentRe.getPaginationNo(),
				paginationDepartmentRe.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public PaginationDto<Map<String, Object>> paginationDepartmentReBy1ForMapList(DepartmentReDto paginationDepartmentRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationDepartmentRe));

		return this.paginationForMapList("userCenter/departmentRe/selectDepartmentReBy1ForObject",
				"userCenter/departmentRe/selectDepartmentReBy1ForMappedObjectList",
				paginationDepartmentRe.getPaginationNo(),
				paginationDepartmentRe.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public int insertDepartmentReLoBy1(DepartmentReLoDto insertDepartmentReLo, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentReLo, insertProperties));
		return this.update("userCenter/departmentReLo/insertDepartmentReLoBy1", modelBuilder.build());
	}

	@Override
	public int deleteDepartmentReLoBy1(DepartmentReLoDto deleteDepartmentReLo, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartmentReLo,
				whereEqProperties));

		return this.update("userCenter/departmentReLo/deleteDepartmentReLoBy1", modelBuilder.build());
	}

	@Override
	public int updateDepartmentReLoBy1(DepartmentReLoDto updateDepartmentReLo, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateDepartmentReLo, updateProperties), new ModelArgs(updateDepartmentReLo, whereEqProperties));

		return this.update("userCenter/departmentReLo/updateDepartmentReLoBy1", modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentReLoBy1ForObject(Class<R> requiredType, DepartmentReLoDto selectDepartmentReLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentReLo,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/departmentReLo/selectDepartmentReLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentReLoBy1ForObjectList(Class<R> requiredType, DepartmentReLoDto selectDepartmentReLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentReLo,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/departmentReLo/selectDepartmentReLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentReLoBy1ForMappedObject(Class<R> mappedClass, DepartmentReLoDto selectDepartmentReLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentReLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/departmentReLo/selectDepartmentReLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentReLoBy1ForMappedObjectList(Class<R> mappedClass, DepartmentReLoDto selectDepartmentReLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentReLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentReLo/selectDepartmentReLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int insertDepartmentCuInEfBy1(DepartmentCuInEfDto insertDepartmentCuInEf, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertDepartmentCuInEf, insertProperties));
		return this.update("userCenter/departmentCuInEf/insertDepartmentCuInEfBy1", modelBuilder.build());
	}

	@Override
	public int deleteDepartmentCuInEfBy1(DepartmentCuInEfDto deleteDepartmentCuInEf, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteDepartmentCuInEf,
				whereEqProperties));

		return this.update("userCenter/departmentCuInEf/deleteDepartmentCuInEfBy1", modelBuilder.build());
	}

	@Override
	public int updateDepartmentCuInEfBy1(DepartmentCuInEfDto updateDepartmentCuInEf, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateDepartmentCuInEf, updateProperties), new ModelArgs(updateDepartmentCuInEf, whereEqProperties));

		return this.update("userCenter/departmentCuInEf/updateDepartmentCuInEfBy1", modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentCuInEfBy1ForObject(Class<R> requiredType, DepartmentCuInEfDto selectDepartmentCuInEf, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentCuInEf,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/departmentCuInEf/selectDepartmentCuInEfBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentCuInEfBy1ForObjectList(Class<R> requiredType, DepartmentCuInEfDto selectDepartmentCuInEf, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentCuInEf,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/departmentCuInEf/selectDepartmentCuInEfBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectDepartmentCuInEfBy1ForMappedObject(Class<R> mappedClass, DepartmentCuInEfDto selectDepartmentCuInEf,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentCuInEf,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/departmentCuInEf/selectDepartmentCuInEfBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectDepartmentCuInEfBy1ForMappedObjectList(Class<R> mappedClass, DepartmentCuInEfDto selectDepartmentCuInEf,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectDepartmentCuInEf,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/departmentCuInEf/selectDepartmentCuInEfBy1ForMappedObjectList",
				modelBuilder.build());
	}
}